package top.chenfu1201.mapper.controller.rest;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class JpaRestController {

    @Value("${jpa.hello.url}")
    private String jpaHellourl;

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/ok")
    public Object restOk() {
        System.out.println(this.getClass().getName());
        JSONObject jsonObject = this.restTemplate.getForObject(jpaHellourl, JSONObject.class);
        JSON.toJavaObject(jsonObject,Object.class);
        return jsonObject;
    }

}
